package com.zxx.dis.controller;

import com.zxx.dis.service.StockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@Controller
@ResponseBody
public class DisLockController {
    private final StockService stockService;

    @Autowired
    public DisLockController(StockService stockService) {
        this.stockService=stockService;
    }

    @GetMapping("/deduct")
    public String deduct() throws InterruptedException {
       stockService.deduct();
        return "dislock success";
    }
}
